<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSeckillUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('seckill_users', function (Blueprint $table) {
            $table->id();
            $table->integer('seckill_id')->comment('秒杀商品ID')->index();
            $table->integer('user_id')->comment('用户ID')->index();
            $table->decimal('seckill_price',8,2)->comment('秒杀金额');
            $table->integer('num')->default(0)->comment('最多秒杀几个');
            $table->string('status',32)->default('participating')->comment('状态 participating:进行中 endOfActivitySuccess 已成功 endOfActivityFail 已失败');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('seckill_users');
    }
}
